package controlSoftware.view;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.ImageObserver;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

import controlSoftware.*;

import controlSoftware.userThread.Coordinate;
import controlSoftware.userThread.SensorData;

public class viewController implements ImageObserver{
	public void updateView(SensorData data, Coordinate prev){
		Image img = null;
		try{img = ImageIO.read(new File("img/image.png")); }
		catch(IOException e){}
		
		
		Graphics g = mainUI.canvas1.getGraphics();
		g.setColor(Color.BLACK);
		g.clearRect((int)(prev.getX()), (int)(prev.getY()), 50, 50);
		//g.fillOval((int)(data.currLoc.getX()), (int)(data.currLoc.getY()), 10, 10);
		g.drawImage(img, (int)(data.currLoc.getX()), (int)(data.currLoc.getY()), 30, 30, this);
		
		//g.setColor(Color.ORANGE);
		//g.drawOval((int)(prev.getX()), (int)(prev.getY()), 5, 5);
	}

	@Override
	public boolean imageUpdate(Image img, int infoflags, int x, int y,
			int width, int height) {
		// TODO Auto-generated method stub
		return false;
	}
}